package com.example.fp.zxd.controller;


import com.example.fp.cgc.code.logAnno.LogAnno;
import com.example.fp.zxd.entity.Gzh;
import com.example.fp.cgc.entity.Type;
import com.example.fp.zxd.mapper.GzhMapper;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 说明: gzh表操作
 * 编写人: 主晓东
 * 编写时间: 2019-12-31
 * 修改时间:
 * gzh相关操作
 */

@RestController
public class GzhController {
    @Autowired
    private GzhMapper gzhMapper;

    @LogAnno(operateType = "公众号查询")
    @ApiOperation("公众号查询")
    @GetMapping("/selectgzh")
    public Gzh selectGzh(int id){ return gzhMapper.selectById(id); }

    @LogAnno(operateType = "公众号添加")
    @ApiOperation("公众号添加")
    @PostMapping("/insertgzh")
    public int insertGzh(Gzh gzh) {
        return gzhMapper.insert(gzh);
    }

    @LogAnno(operateType = "公众号修改")
    @ApiOperation("公众号修改")
    @GetMapping("/updatetgzh")
    public int updateGzh(Gzh gzh) {
        return gzhMapper.updateById(gzh);
    }

    @LogAnno(operateType = "公众号删除")
    @ApiOperation("公众号删除")
    @DeleteMapping("/deletegzh")
    public int deleteGzh(int id) {
        return gzhMapper.deleteById(id);
    }

    @LogAnno(operateType = "公众号类别查询")
    @ApiOperation("公众号类别查询")
    @RequestMapping(value = "/getGzhList",method = RequestMethod.PUT)
    public List<Type> selectGzhList() {
        return gzhMapper.selectTypeList();
    }

}